package com.wxg.common.core.domain.entity;

import lombok.Data;

/**
 * @author void
 * @date 2019/9/10 9:47
 * @desc 接口响应构造器
 */
@Data
public class ResponseBuilder<T> {
    /** 返回编码 */
    private Integer code = 0;
    /** 结果 */
    private boolean success = true;
    /** 消息描述 */
    private String message = "操作成功";
    /** 数据 */
    private T data;
    /** 时间戳 */
    private long timestamp = System.currentTimeMillis();

    public ResponseBuilder setCode(Integer code){
        this.code = code;
        return this;
    }

    public ResponseBuilder setSuccess(boolean success) {
        this.success = success;
        return this;
    }

    public ResponseBuilder setMessage(String message) {
        this.message = message;
        return this;
    }

    public ResponseBuilder setData(T data) {
        this.data = data;
        return this;
    }

    public ResponseBuilder setTimestamp(long timestamp) {
        this.timestamp = timestamp;
        return this;
    }
}
